import { useI18n } from '/@/hooks/web/useI18n';
import { BasicColumn, BasicTableProps, FormProps } from '/@/components/Table';
import { addressListData } from '/@/api/shop/order/soAdvanceOrder';

const { t } = useI18n('sys.order');

const modalProps = {
  title: t('收货地址选择'),
};

const searchForm: FormProps = {
  baseColProps: { lg: 6, md: 8 },
  labelWidth: 80,
  showResetButton:false,
  schemas: [
    {
      label: t('收货人'),
      field: 'cdeliverunit',
      component: 'Input',
    },
    {
      label: t('联系电话'),
      field: 'cenglishadd4',
      component: 'Input',
    },
    {
      label: t('收货地址'),
      field: 'cdeliveradd',
      component: 'Input',
    },
    {
      label: t('客户编码'),
      field: 'ccuscode',
      component: 'Input',
      show:false
    },

    
  ],
};

const tableColumns: BasicColumn[] = [
  {
    title: t('收货人'),
    dataIndex: 'cdeliverunit',
    key: 'a.cdeliverunit',
    sorter: true,
    width: 80,
    align: 'left',
  },
  {
    title: t('联系电话'),
    dataIndex: 'cenglishadd4',
    key: 'a.cenglishadd4',
    sorter: true,
    align: 'left',
    width: 100,
  },
  {
    title: t('收货地址'),
    dataIndex: 'cdeliveradd',
    key: 'a.cdeliveradd',
    sorter: true,
    width: 200,
  },
  {
    title: t('是否默认'),
    dataIndex: 'bdefault',
    key: 'a.bdefault',
    sorter: true,
    width: 80,
    dictType: 'sys_yes_no',
  },
];

const tableProps: BasicTableProps = {
  api: addressListData,
  beforeFetch: (params) => {
    params['isAll'] = true;
    //params['ope'] = '1';
    return params;
  },
  columns: tableColumns,
  formConfig: searchForm,
  rowKey: 'id',
};

export default {
  modalProps,
  tableProps,
  itemCode: 'cdeliveradd',
  itemName: 'cdeliveradd',
};
